package anatex.web;

import anatex.semantics.RelatedCategoriesFinder;
import anatex.semantics.RelatedDocumentsFinder;
import anatex.semantics.Wikipedia;
import anatex.domain.Category;
import anatex.domain.Document;
import anatex.domain.Keyword;
import anatex.domain.DocumentCategory;

import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
import java.util.ArrayList;
import java.util.Iterator;

import javax.persistence.NoResultException;
import javax.persistence.NonUniqueResultException;
import javax.persistence.PersistenceException;

import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestTemplate;

@Controller
public class WsController {
	
	@RequestMapping(value="/ws/test", method = RequestMethod.GET)
    public String testWs(Model model) {
		RelatedCategoriesFinder rcf = new RelatedCategoriesFinder();
		RelatedDocumentsFinder rdf = new RelatedDocumentsFinder();
		
		Document document = Document.findDocument(new Long(4052));
		
		rcf.findAndLog(document);
		rdf.findAndLog(document);
		
		model.addAttribute("result", ":P");
		
		return "ws/test";
    }
}
